]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
magnifier.js: Fix zoom juddering
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Thu, 10 May 2018 10:13:49 +0000 (18:13 +0800)
committerDaniel van Vugt <daniel.van.vugt@canonical.com>
Thu, 17 May 2018 03:42:20 +0000 (11:42 +0800)
Make Zoom respond to the mouse silky-smoothly.

It was previously hard-coded to: 1000/50 = 20 FPS.

https://bugzilla.gnome.org/show_bug.cgi?id=682013
https://launchpad.net/bugs/1691675

js/ui/magnifier.js

index b752b127a55dc89d1f89e1b067bc571e784f7ed6..3103630ca49936fb446f34346c10f62f84df7b0d 100644 (file)
@@ -19,7 +19,6 @@ const MagnifierDBus = imports.ui.magnifierDBus;
 const Params = imports.misc.params;
 const PointerWatcher = imports.ui.pointerWatcher;
 
-var MOUSE_POLL_FREQUENCY = 50;
 var CROSSHAIRS_CLIP_SIZE = [100, 100];
 var NO_CHANGE = 0.0;
 
@@ -152,8 +151,10 @@ var Magnifier = new Lang.Class({
      * Turn on mouse tracking, if not already doing so.
      */
     startTrackingMouse() {
-        if (!this._pointerWatch)
-            this._pointerWatch = PointerWatcher.getPointerWatcher().addWatch(MOUSE_POLL_FREQUENCY, this.scrollToMousePos.bind(this));
+        if (!this._pointerWatch) {
+            let interval = 1000 / Clutter.get_default_frame_rate();
+            this._pointerWatch = PointerWatcher.getPointerWatcher().addWatch(interval, this.scrollToMousePos.bind(this));
+        }
     },
 
     /**